# -*- coding: utf-8 -*-
import time
from selenium import webdriver
import unittest
import xlrd
from venv1.Page.loginPage import loginPage
from venv1.publicModule.login import login
from venv1.Page.policyIfmComPage import policyIfmComPage
from venv1.publicModule.policyIfmCom import policyIfmCom
from venv1.publicModule.UWfllowup import UWfllowup
class PolicyIfmCom_Case(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        print('开始测试')
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()
        self.driver.get("http://10.22.26.74:8080/dist/index.html#/")
        time.sleep(2)
        self.loginPage = loginPage(self.driver)
        self.login = login(self.driver)
        self.policyIfmComPage=policyIfmComPage(self.driver)
        self.policyIfmCom=policyIfmCom(self.driver)
        self.UWfllowup=UWfllowup(self.driver)

 # @classmethod
    # def tearDownClass(self):
    #     print('结束测试')
    #     self.driver.quit()
    def test01(self):
        filename= r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
        excel_open=xlrd.open_workbook(filename)
        table=excel_open.sheet_by_name('Sheet1')
        rows=table.nrows
        for i in range(2,rows):
            row_content=table.row_values(i)
            username=row_content[0]
            password=row_content[1]
            login.login(self,username,password)
    def test02(self):
        filename = r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            PolicyNo = row_content[3]
            policyIfmCom.PolicyIfm_comfire(self,PolicyNo)
    def test03(self):
        filename = r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            PolicyNo = row_content[3]
            UWfllowup.UW_fllowup(self,PolicyNo)
    def test04(self):
        UWfllowup.lifeasia(self)



if __name__ == '__main__':
    suite = unittest.TestLoader.loadTestsFromTestCase(PolicyIfmCom_Case)
    unittest.TextTestRunner().run(suite)